package 集合.Collection.Collection中的常用方法.Test01;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionTest01 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        c.add(300);
        c.add(new Object());
        System.out.println(c.size());
        c.clear();
        System.out.println(c.size());
        c.add(1);
        c.add(2);
        c.add(3);
        c.add(4);
        System.out.println(c.contains(1));
        c.remove(1);
        System.out.println(c.contains(1));
        System.out.println(c.isEmpty());
        c.clear();
        System.out.println(c.isEmpty());

        c.add(1);
        c.add(2);
        c.add(3);
        c.add(4);
        Object[] o = c.toArray();
        for (int i = 0; i < o.length; i++) {
            System.out.println(o[i]);
        }
    }
}
